home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / awe2-0_1.lha / awe2-0.1 / Src / RCS / SimulationMultiplexor.h,v < prev    next >
Text File  |  1989-10-26  |  2KB  |  142 lines

  1. head     3.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    grunwald:3.2; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 3.2
  10. date     89.02.20.15.37.29;  author grunwald;  state Exp;
  11. branches ;
  12. next     3.1;
  13.  
  14. 3.1
  15. date     88.12.20.13.50.17;  author grunwald;  state Exp;
  16. branches ;
  17. next     1.1;
  18.  
  19. 1.1
  20. date     88.10.30.13.06.05;  author grunwald;  state Exp;
  21. branches ;
  22. next     ;
  23.  
  24.  
  25. desc
  26. @@
  27.  
  28.  
  29. 3.2
  30. log
  31. @Start using Gnu library heaps for schedulers
  32. @
  33. text
  34. @// This may look like C code, but it is really -*- C++ -*-
  35. // 
  36. // Copyright (C) 1988 University of Illinois, Urbana, Illinois
  37. //
  38. // written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
  39. //
  40. #ifndef SimulationMultiplexor_h
  41. #define SimulationMultiplexor_h
  42.  
  43. #include "CpuMultiplexor.h"
  44. #include "HardwareContext.h"
  45.  
  46. //
  47. //    Like it says.
  48. //
  49. extern double CurrentSimulatedTime;
  50. extern const double NullTime;
  51.  
  52. class SpinBarrier;
  53. class TimeSchedulerPQ;
  54.  
  55. class SimulationMultiplexor : public CpuMultiplexor {
  56. protected:
  57.  
  58.     TimeSchedulerPQ *myPendingEvents;
  59.  
  60.     SpinLock *myPendingEventsLock;
  61.  
  62.     SpinBarrier *cpuBarrier;
  63.  
  64.     virtual int advanceTime();
  65.     virtual void allocateLocalEventStructures(int,int);
  66.     virtual void allocateEventStructures(int,int);
  67.     virtual void deallocateEventStructures();
  68.  
  69. public:
  70.     SimulationMultiplexor(int debug = 0, int barrierMaxLoops = 0);
  71.     ~SimulationMultiplexor();
  72.  
  73.     virtual void warmThePot(int);
  74.     virtual void stirItAround();
  75.     virtual void coolItDown();
  76.  
  77.     virtual void addAt(Thread *, double);
  78.     virtual void addWithDelay(Thread *, double);
  79.     virtual void hold( double time );
  80.     virtual void await( double time );
  81. };
  82.  
  83. extern SimulationMultiplexor *ThisSimulationMultiplexor;
  84.  
  85. inline double simulatedClock() {
  86.     return( CurrentSimulatedTime );
  87. }
  88.  
  89. inline void hold(double holdFor)
  90. {
  91.     if (holdFor > 0) {
  92.     ThisSimulationMultiplexor -> await( CurrentSimulatedTime + holdFor );
  93.     }
  94. }
  95.  
  96. inline void await(double till)
  97. {
  98.     ThisSimulationMultiplexor -> await(till);
  99. }
  100.  
  101. #endif /* SimulationMultiplexor_h */
  102. @
  103.  
  104.  
  105. 3.1
  106. log
  107. @Steay version
  108. @
  109. text
  110. @d20 1
  111. d25 2
  112. a26 1
  113.     AwesimeHeap *myPendingEvents;
  114. @
  115.  
  116.  
  117. 1.1
  118. log
  119. @Initial revision
  120. @
  121. text
  122. @d30 2
  123. a31 1
  124.     virtual void allocateEventStructures(int);
  125. d35 1
  126. a35 1
  127.     SimulationMultiplexor(int debug = 0);
  128. d54 1
  129. a54 2
  130. inline void
  131. SimulationMultiplexor::hold(double holdFor)
  132. d57 1
  133. a57 1
  134.     await( CurrentSimulatedTime + holdFor );
  135. a58 5
  136. }
  137.  
  138. inline void hold(double holdFor)
  139. {
  140.     ThisSimulationMultiplexor -> hold(holdFor);
  141. @
  142.